"use client";
import { BannerRep } from "@/api/home";
import Box from "@/components/Box";
import { FC, PropsWithChildren } from "react";
import { Swiper, SwiperSlide } from "swiper/react";
// const Box = dynamic(() => import("@/components/Box"));
interface Props {
    banners: BannerRep[];
}

const HomeCard: FC<PropsWithChildren<Props>> = (props) => {
    const { banners = [] } = props;
    return (
        <Swiper slidesPerView={2} spaceBetween={10}>
            {banners?.map((banner, index) => (
                <SwiperSlide key={index} className={"my-[0.08rem]"}>
                    <Box
                        className={""}
                        none
                        action={banner.action_type}
                        actionData={banner.action_params}
                    >
                        <img
                            src={banner.content!}
                            alt=""
                            className={"w-[100%] rounded-[0.06rem]"}
                        />
                    </Box>
                </SwiperSlide>
            ))}
        </Swiper>
    );
};

export default HomeCard;
